Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generating parameters*of lognormal distribution

    Dear Stata users,

    I am using Stata 17 and would like to simulate a lognormal distribution with parameters as shown below

    Click image for larger version

Name:	example.png
Views:	1
Size:	14.0 KB
ID:	1654410


    where E(Y) is average income and G the Gini coefficient of a specific country
    The code am using is
    Code:
    local meani = 9791.288442
    local gini = 0.59203426 
        
    set seed 158961
    
    clear
    set obs 18802
    
    
    gen sigma = sqrt(2)*(1/normal(1))*((`gini' + 1)/2)
    gen mu = log(`meani') - (sigma^2)/2
    gen lognormal_inc = exp(rnormal(mu, sigma))
    
    mean lognormal_inc
    fastgini lognormal_inc
    Robust analysis as per the last two commands show that the resulting distribution has biased estimates. My guess is the issue may be arising from how I am generating the inverse standard normal variate.

    Any advice would be appreciated.

    Thanks in advance




  • #2
    Hi, Stephen.

    I don't think sigma has been generated correctly, since 1/normal(1) is not the cumulative standard normal distribution. In Stata, (1/normal(1)) means 1.188. Try this:

    Code:
     
     gen sigma = sqrt(2)*invnormal((`gini' + 1)/2)

    Comment


    • #3
      Thanks so much Tiago Pereira Your suggestion works!!

      Comment

      Working...
      X